import './assets/main.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'
// 引入 echarts
import ECharts from 'vue-echarts'
// 导入 ECharts 核心组件和渲染器
import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
// 导入需要的图例
import { LineChart } from 'echarts/charts';
// 导入vant组件
import 'vant/lib/index.css';
import { 
  Tabbar, 
  TabbarItem,
  Search,
  List,
  Cell,
  Sidebar, 
  SidebarItem,
  Button,
  NavBar,
  Col,
  Row,
  Calendar,
  PullRefresh
} from 'vant';
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  LegendComponent
} from 'echarts/components';
import piniaPluginPersist from 'pinia-plugin-persist' ;
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
const pinia = createPinia();
pinia.use(piniaPluginPersist) 
// 注册必要的组件
echarts.use([
  CanvasRenderer,
  LineChart,
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  LegendComponent
]);
// 绑定vant组件
app.use(Tabbar);
app.use(TabbarItem);

app.component('v-chart', ECharts);
app.use(pinia);
app.use(router);
app.use(Search);
app.use(List);
app.use(Cell);
app.use(Sidebar);
app.use(SidebarItem);
app.use(Button);
app.use(NavBar);
app.use(Col);
app.use(Row);
app.use(Calendar);
app.use(PullRefresh);
app.use(ElementPlus, { 
    locale: zhCn,  
    size: 'small', 
    zIndex: 3000 
})
app.mount('#app')
